<template>
  <Tooltip placement="top" v-bind="getBindProps">
    <template #title>
      <span>{{ t('component.table.goHome') }}</span>
    </template>
    <HomeFilled @click="goHome"  style="margin-left: 20px"/>
  </Tooltip>
</template>
<script lang="ts">
  import { computed, defineComponent } from 'vue';
  import { Tooltip } from 'ant-design-vue';
  import { HomeFilled,HomeOutlined } from '@ant-design/icons-vue';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { router } from '/@/router';
  import { useGo } from '/@/hooks/web/usePage';
  import { PageEnum } from '/@/enums/pageEnum';
  import { useUserStore } from '/@/store/modules/user';

  export default defineComponent({
    name: 'Home',
    props: {
      isMobile: Boolean,
    },
    components: {
      HomeFilled,
      HomeOutlined,
      Tooltip,
    },

    setup(props) {
      const { t } = useI18n();
      const go = useGo();
      const userStore = useUserStore();
      const goHome = ()=>{
        go(userStore.getUserInfo.homePath || PageEnum.BASE_HOME);
      };
      const getBindProps = computed(() => {
        let obj = {};
        if (props.isMobile) {
          obj['visible'] = false;
        }
        return obj;
      });
      return {
        getBindProps,
        goHome,
        t,
      };
    },
  });
</script>
